<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">

    <link rel="stylesheet" href="//at.alicdn.com/t/font_tnyc012u2rlwstt9.css" media="all"/>
    <link rel="stylesheet" href="{:_SKIN}/shadmin/v3//css/news.css" media="all"/>
</head>
<body class="childrenBody">

<a class="layui-btn layui-btn-normal" href="{:Url('gg',['pid'=>input('id')])}">添加</a>

<div class="layui-form news_list">
    <table class="layui-table">
        
        <thead>
        <tr>
           
            <th>规格</th>
            <th>价格</th>
            <th>操作</th>
           
        </tr>
        </thead>
        <tbody class="news_content">
        {empty name="list"}
        <tr><td>暂无内容</td><td></td><td></td></tr>

{/empty}
        {volist name="list" id="v"}
        <tr id="d{$v.id}">
            
           
            <td>{$v.name}</td>
            <td>￥{$v.price}</td>
            <td>


                <a class="layui-btn layui-btn-danger layui-btn-mini pro_del" data-id="{$v.id}">删除</a>


            </td>
        </tr>
        {/volist}
        </tbody>
    </table>
</div>

<div id="page">{$page}</div>
{:jq()}
{:layui()}
<style>
    .pagination {
        margin-left: 50px;
    }

    .pagination li {
        float: left;
        background: #34a8fe;
        color: #fff;
        margin-right: 8px;
    }

    .pagination li a, .pagination li span {
        color: #fff;
        padding: 8px 10px;
        display: block
    }

    .pagination .active {
        background-color: #fe6738
    }

</style>
<script>

   


   $(".pro_del").click(function () {
        var id = $(this).data('id');
        parent.layer.confirm("确定要删除吗？删除后不可恢复", function () {
            $("#d"+id).remove();
              parent.layer.msg('删除成功', {shift: 0, time: 1000}, function () {


                    });
            $.post("{:url('dev/delapi')}", {t: 'product_price',k:'id',v:id}, function (res) {

                if (res.code == 200) {


                  

                } else {

                    parent.layer.msg(res.msg);

                }

            });


        });


    });



    //修改产品状态
    layui.form.on('switch(isShow)', function (data) {
        var id = $(data.elem).data('id');


        var key = data.elem.checked ? 1 : 0;

        $.post("{:url('dev/sells')}", {id: id, key: key}, function (res) {

            if (res.code != 200) {

                panent.layer.alert('网络繁忙，请重试');

            }

        });


    });

    //预览产品

    $(".v_product").click(function(){

        var url=$(this).data('url');

        layer.open({
            type: 2,
            title: '商品预览',
            shadeClose: true,
            shade: 0.8,
            area: ['380px', '90%'],
            content: url //iframe的url
        });



    });

</script>
</body>
</html>